package cn.wgoodq.domain.propDemo;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.*;

/**
 * Created by OuKyou on 2017/4/10.
 */
@Component
@ConfigurationProperties(prefix = "myProps")
public class MyProps {
    private String simpleProp;
    private String[] arrayProps;
    // 接收prop1里面的属性值
    private List<Map<String, String>> listProp1 = new ArrayList<>();
    // 接收prop2里面的属性值
    private List<String> listProp2 = new ArrayList<>();
    // 接收mapProps里面的属性值
    private Map<String, String> mapProps = new HashMap<>();

    public String getSimpleProp() {
        return simpleProp;
    }

    public void setSimpleProp(String simpleProp) {
        this.simpleProp = simpleProp;
    }

    public String[] getArrayProps() {
        return arrayProps;
    }

    public void setArrayProps(String[] arrayProps) {
        this.arrayProps = arrayProps;
    }

    public List<Map<String, String>> getListProp1() {
        return listProp1;
    }

    public void setListProp1(List<Map<String, String>> listProp1) {
        this.listProp1 = listProp1;
    }

    public List<String> getListProp2() {
        return listProp2;
    }

    public void setListProp2(List<String> listProp2) {
        this.listProp2 = listProp2;
    }

    public Map<String, String> getMapProps() {
        return mapProps;
    }

    public void setMapProps(Map<String, String> mapProps) {
        this.mapProps = mapProps;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("MyProps{");
        sb.append("simpleProp='").append(simpleProp).append('\'');
        sb.append(", arrayProps=").append(arrayProps == null ? "null" : Arrays.asList(arrayProps).toString());
        sb.append(", listProp1=").append(listProp1);
        sb.append(", listProp2=").append(listProp2);
        sb.append(", mapProps=").append(mapProps);
        sb.append('}');
        return sb.toString();
    }
}
